package com.goods.business.converter;

import com.goods.common.model.business.OutStock;
import com.goods.common.vo.business.OutStockVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class OutStockConverter {
    public static List<OutStockVO> converterToOutStockVOList(List<OutStock> outStocks) {
        if (!CollectionUtils.isEmpty(outStocks)){
            List<OutStockVO> outStockVOS = new ArrayList<>();
            for (OutStock outStock : outStocks) {
                OutStockVO outStockVO = new OutStockVO();
                BeanUtils.copyProperties(outStock,outStockVO);
                outStockVO.setConsumerId(outStock.getConsumerId());
                outStockVOS.add(outStockVO);
            }
            return outStockVOS;
        }
        return null;
    }
}
